<template>
	<view class="mainpadding2 mainbgc" v-show="show">
		<view class="border-r1 ffffff margin-top mainpadding flexleft" v-if="list.data.length" v-for="item in list.data" :key="item.id" @click="jumpdetail(item.id)">
			<view class="leftimg">
				<image :src="item.image_text" mode=""></image>
			</view>
			<view class="rightmsg">
				<view class="titleText yhxiankuan">{{item.title}}</view>
				<view class="nostrongtext margin-top lhxiankuan">{{item.des}}</view>
			</view>
		</view>
		
		<view class="flexcenter1" v-if="!list.data.length">
			<view class="placeholderimg" style="margin-top: 300rpx;">
				<image src="../../static/images/bg-icons/placeholderimg.png" mode=""></image>
			</view>
			<view class="zanwushuju">暂无数据~</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				show:false,
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			// 热门推荐列表
			init(isPage, page) {
				let _this = this;
				httpRequest.request('api/index/noticeList', 'GET', {
					page: page || 1,
					limit: _this.limit,
				}, false, false, false).then(res => {
					this.show=true
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					this.show=true
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			jumpdetail(id){
				uni.navigateTo({
					url:"/pages/hotel/gongluexq?id="+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.border-r1:nth-child(1){
		margin: 0;
	}
	.titleText{
		font-size: 30rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
	}
	.nostrongtext{
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}
	.mainpadding2{
		padding: 30rpx 30rpx 30rpx;
	}
	.leftimg{
		// flex:1.5;
		width: 163rpx;
		height: 163rpx;
		border-radius: 10rpx;
		margin-right: 30rpx;
		image{
			width: 100%;
			height: 100%;
			border-radius: 10rpx;
		}
	}
	.lhxiankuan {
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden; //溢出内容隐藏
		text-overflow: ellipsis; //文本溢出部分用省略号表示
		display: -webkit-box; //特别显示模式
		-webkit-line-clamp: 3; //行数
		line-clamp: 3;
		-webkit-box-orient: vertical; //盒子中内容竖直排列
	}
	.rightmsg{
		flex: 4;
	}
</style>
